import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  //登录
  {
    path: "/",
    name: "login",
    component: () => import("@/views/login/index.vue"),
  },
  //首页
  {
    path: "/home",
    name: "home",
    component: () => import("@/views/home/index.vue"),
    children: [
      {
        // 当 /user/:id/profile 匹配成功，
        // UserProfile 会被渲染在 User 的 <router-view> 中
        path: "commodity",
        component: () => import("@/components/commodity/index.vue"),
      },
      {
        path: "user",
        component: () => import("@/components/user/index.vue"),
      },
    ],
  },
  //记录
  {
    path: "/record",
    name: "record",
    component: () => import("@/views/home/index.vue"),
    children: [
      {
        path: "index",
        component: () => import("@/components/record/index.vue"),
      },
      {
        path: "transfer",
        component: () => import("@/components/record/transfer.vue"),
      },
      {
        path: "recharge",
        component: () => import("@/components/record/recharge.vue"),
      },
    ],
  },

  //公告
  {
    path: "/notice",
    name: "notice",
    component: () => import("@/views/home/index.vue"),
    children: [
      {
        path: "index",
        component: () => import("@/components/notice/index.vue"),
      },
    ],
  },
  //退款
  {
    path: "/money",
    name: "money",
    component: () => import("@/views/home/index.vue"),
    children: [
      {
        path: "index",
        component: () => import("@/components/money/index.vue"),
      },
    ],
  },

  //轮播图
  {
    path: "/banner",
    name: "banner",
    component: () => import("@/views/home/index.vue"),
    children: [
      {
        path: "index",
        component: () => import("@/components/banner/index.vue"),
      },
    ],
  },
  //贷款
  {
    path: "/loan",
    name: "loan",
    component: () => import("@/views/home/index.vue"),
    children: [
      {
        path: "index",
        component: () => import("@/components/loan/index.vue"),
      },
    ],
  },
  //会员
  {
    path: "/member",
    name: "member",
    component: () => import("@/views/home/index.vue"),
    children: [
      {
        path: "index",
        component: () => import("@/components/member/index.vue"),
      },
    ],
  },
  //余额流水
  {
    path: "/balance",
    name: "balance",
    component: () => import("@/views/home/index.vue"),
    children: [
      {
        path: "index",
        component: () => import("@/components/balance/index.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  base: "/",
  routes,
});

export default router;
